package com.example.shop.fgo.ui.popwindow;

import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.example.shop.fgo.R;

import org.xutils.common.util.DensityUtil;

/**
 * Created by Administrator on 2017/2/16.
 */

public class PopMoreFragWp extends PopupWindow{
    private View mView;
    private LayoutInflater mLayoutInflater;

    private FrameLayout mTvYscBottomFragWp;
    private FrameLayout mTvYxzBottomFragWp;
    private TextView mTvDirBottomFragWp;
    private TextView mTvSortBottomFragWp;
    private TextView mTvSearchBottomFragWp;
    private TextView mTvRefreshBottomFragWp;
    private View.OnClickListener mOnClickListener;

    public void setOnClickListener(View.OnClickListener onClickListener) {
        mOnClickListener = onClickListener;

        mTvYscBottomFragWp.setOnClickListener(mOnClickListener);
        mTvYxzBottomFragWp.setOnClickListener(mOnClickListener);
        mTvDirBottomFragWp.setOnClickListener(mOnClickListener);
        mTvSortBottomFragWp.setOnClickListener(mOnClickListener);
        mTvSearchBottomFragWp .setOnClickListener(mOnClickListener);
        mTvRefreshBottomFragWp.setOnClickListener(mOnClickListener);
    }

    public PopMoreFragWp(Context context) {
        super(context);
        //以后写popwindow无脑写上，否则背景会有一定的问题
        this.setBackgroundDrawable(new BitmapDrawable());
        //设置不抢占焦点
        this.setFocusable(true);
        mLayoutInflater=LayoutInflater.from(context);
        mView=mLayoutInflater.inflate(R.layout.pop_more_frag_wp,null);
        //设置popwindow上面的控件
        this.setContentView(mView);
        initViews();
        this.setOutsideTouchable(true);
        this.setWidth(DensityUtil.getScreenWidth());
        this.setHeight(DensityUtil.dip2px(121));
    }

    private void initViews() {
        mTvYscBottomFragWp = (FrameLayout) mView.findViewById(R.id.tv_ysc_bottom_frag_wp);
        mTvYxzBottomFragWp = (FrameLayout) mView.findViewById(R.id.tv_yxz_bottom_frag_wp);
        mTvDirBottomFragWp = (TextView) mView.findViewById(R.id.tv_dir_bottom_frag_wp);
        mTvSortBottomFragWp = (TextView) mView.findViewById(R.id.tv_sort_bottom_frag_wp);
        mTvSearchBottomFragWp = (TextView) mView.findViewById(R.id.tv_search_bottom_frag_wp);
        mTvRefreshBottomFragWp = (TextView) mView.findViewById(R.id.tv_refresh_bottom_frag_wp);

    }

}
